<?php
$arr=$_POST;
$pwd=md5($arr['pwd']);//加密
$dbh=new PDO('mysql:host=localhost;dbname=gaofei','root','root');
$sql="select * from zc where username='{$arr['username']}' and pwd='$pwd' and is_admin=1";
//echo $sql;die;
$users=$dbh->query($sql)->fetch(PDO::FETCH_ASSOC);
if($users)
{
    setcookie('username',$users['username']);
    header("location:show.php");
}
else{
    echo "登陆失败";
}
